package xkp.lesson2;

import java.util.Scanner;

public class ResolvePrime {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.println("输入要分解质因数的整数：");
		int n = input.nextInt();
		ResolvePrime num = new ResolvePrime(n);
		input.close();
	}
	public ResolvePrime(int num) {
		int i=2;
		while(num!=1) {
			int temp = num%i; 
			if(temp==0&&isPrime(i)) {
				num/=i;
				System.out.println(i);
			}else {
				i++;
			}
		}    
	}
	static boolean isPrime(int i) {
		for(int j=2;j<i/2;j++) {
			if(i%j==0) {
				return false;
			}
		}
		return true;
	}
}
